package com.beiing.tianshuai.tianshuai.mine.presenter;

import com.beiing.tianshuai.tianshuai.entity.CommonBean;
import com.beiing.tianshuai.tianshuai.entity.MyCollectionBean;
import com.beiing.tianshuai.tianshuai.mine.model.MyCollectionModel;
import com.beiing.tianshuai.tianshuai.mine.view.MyCollectionViewImpl;

/**
 * Created by Jinni on 2017/7/16 0016.
 */

public class MyCollectionPresenter implements MyCollectionPresenterImpl, MyCollectionModel.OnRequestListener {

    private MyCollectionViewImpl mCollectionView;
    private MyCollectionModel mCollectionModel;

    public MyCollectionPresenter(MyCollectionViewImpl myCollectionView) {
        mCollectionView = myCollectionView;
        mCollectionModel = new MyCollectionModel(this);
    }

    @Override
    public void getCollectionResult(String id) {
        mCollectionView.showProgress();
        mCollectionModel.getCollectionResult(id);
    }

    @Override
    public void getDelResult(String uid, String id) {
        mCollectionModel.getDelResult(uid, id);
    }

    @Override
    public void onSuccess(MyCollectionBean bean) {
        mCollectionView.hideProgress();
        mCollectionView.onRequestSuccess(bean);
    }

    @Override
    public void onError(Throwable throwable) {
        mCollectionView.hideProgress();
        mCollectionView.onRequestFailed(throwable);
    }

    @Override
    public void onDelSuccess(CommonBean bean) {
        mCollectionView.onDelResult(bean);
    }
}
